<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
<script>
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.open("GET","Project3.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML; 
x=xmlDoc.getElementsByTagName("DVD");

function displayDVDInfo(i)
{
name=(x[i].getElementsByTagName("Name")[0].childNodes[0].nodeValue);
director=(x[i].getElementsByTagName("Director")[0].childNodes[0].nodeValue);
year=(x[i].getElementsByTagName("Year")[0].childNodes[0].nodeValue);
genre=(x[i].getElementsByTagName("Genre")[0].childNodes[0].nodeValue);
txt="Name: "+name+"<br>Director: "+director+"<br>Year: "+year+"<br>Genre: "+genre ;
document.getElementById("showDVD").innerHTML=txt;
}
</script>
</head>

<body>
<div id='showDVD'>Click on a DVD to display dvd information.</div><br>
<script>
document.write("<table border='1'>");
for (var i=0;i<x.length;i++)
  { 
  document.write("<tr onclick='displayDVDInfo(" + i + ")'>");
  document.write("<td>");
  document.write(x[i].getElementsByTagName("Name")[0].childNodes[0].nodeValue);
  document.write("</td><td>");
  document.write(x[i].getElementsByTagName("Director")[0].childNodes[0].nodeValue);
  document.write("</td></tr>");
  }
document.write("</table>");
</script>

</body>
</html>


